package ocean.inventoryprotection.common.world.item;

import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import ocean.inventoryprotection.common.config.ApplicationConfig;

import javax.annotation.Nullable;
import java.util.List;

/**
 * 保护符
 *
 * @author zhang
 * @since 2023/1/14
 */
public class Protector extends Item {

    public Protector() {
        super(new Properties().tab(ItemGroup.TAB_MISC));
    }

    @Override
    public void appendHoverText(ItemStack itemStack, @Nullable World world, List<ITextComponent> components,
                                ITooltipFlag tooltipFlag) {
        for (String lore : ApplicationConfig.LORE.get()) {
            components.add(new StringTextComponent(lore));
        }
        itemStack.setHoverName(new StringTextComponent(ApplicationConfig.DIS_PLAYER_NAME.get()));
    }
}
